package com.lingjtx.common.security.limit;

import com.lingjtx.common.core.RedisOptions;
import com.lingjtx.common.core.ResponseResult;


/**
 * 行为注解可以用状态模式来实现
 * 多种状态：忽略登录、不可重复提交数据、限制行为注解...(可以扩展)
 */
public abstract class HandlerState<Point, Request> {
    protected ApiContext<Point, Request> context;

    // 错误返回状态
    protected boolean errorState = false;

    public void setContext(ApiContext<Point, Request> context) {
        this.context = context;
    }

    public void setErrorState(boolean errorState) {
        this.errorState = errorState;
    }

    public abstract ResponseResult<Object> retError();

    public abstract void handler(Point point, Request request, RedisOptions redis);
}
